package com.atguigu.mybatis.mapper;

import com.atguigu.mybatis.bean.Employee;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * Created by Smexy on 2022/12/30
 *
 *
 *      有些公司为了编码方便，也会选择直接将sql和代码耦合在一起！
 *
 *      编写什么sql，就使用对应的注解
 *
 */
public interface EmployeeMapper2
{
    @Select("select  * from employee where id = #{efjaklfeakl}")
    Employee getEmployeeById(Integer id);

    @Insert(" insert into employee(last_name,gender,email) values(#{lastName},#{gender},#{email}) ")
    void insertEmployee(Employee employee);

    @Update("update employee set last_name = #{lastName} , gender = #{gender} , email = #{email} " +
        "         where id = #{id}")
    void updateEmployee(Employee employee);

    @Delete(" delete from employee where id = #{xxxxefae}")
    void deleteEmployeeById(Integer id);

    @Select(" select  * from employee  ")
    List<Employee> getAll();
}
